package edu.nyu.cyrus;

import java.util.ArrayList;
import java.util.Collections;

public class CyrusMainClass {

	public static void main(String[] args) {

		CyrusParser cparser = new CyrusParser();
		ArrayList<PersonDataModel> data = new ArrayList<PersonDataModel>();
		try {
			data.addAll(cparser.parseFile(
					".\\src\\org\\rohan\\cyrus\\codetest_files\\input_files\\pipe.txt", "\\|"));
			data.addAll(cparser.parseFile(
					".\\src\\org\\rohan\\cyrus\\codetest_files\\input_files\\space.txt", " "));
			data.addAll(cparser.parseFile(
					".\\src\\org\\rohan\\cyrus\\codetest_files\\input_files\\comma.txt", ","));
		} catch (Exception e) {
			e.printStackTrace();
		}		
		
		
		Collections.sort(data, new CompareByGenderAsc());
		System.out.println("Output 1:");
		for (PersonDataModel dm : data) {
			System.out.println(dm.getLname() + " " + dm.getFname() + " " + dm.getGender() + " " + dm.getDob()+ " " + dm.getColor());
		}
		System.out.println();
		Collections.sort(data, new CompareByDOB());
		System.out.println("Output 2:");
		for (PersonDataModel dm : data) {
			System.out.println(dm.getLname() + " " + dm.getFname() + " " + dm.getGender() + " " + dm.getDob()+ " " + dm.getColor());
		}
		System.out.println();
		Collections.sort(data, new CompareByLNameDesc());
		System.out.println("Output 3:");
		for (PersonDataModel dm : data) {
			System.out.println(dm.getLname() + " " + dm.getFname() + " " + dm.getGender() + " " + dm.getDob()+ " " + dm.getColor());
		}
	}
}
